#define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>
#include<string.h>
#include<assert.h>
int my_strncmp(const char* p1, const char* p2, size_t num) {
	assert(p1 && p2);
	while (num) {
		if (*p1 == *p2) {
			p1++;
			p2++;
		}
		else {
			break;
		}
		num--;
	}
	if (num == 0) {
		return 0;
	}
	if (*p1 - *p2 > 0) {
		return 1;
	}
	else {
		return -1;
	}
}
int main()
{
	char arr1[10] = "abpdi";
	char arr2[10] = "abpf";
	int n = 5;
	printf("%d\n", strncmp(arr1, arr2, n));
	printf("%d\n", my_strncmp(arr1, arr2, n));

	return 0;
}